layui.use(['layer', 'form', 'carousel', 'jquery', 'element'], function () {
  var layer = layui.layer
    , form = layui.form
    , carousel = layui.carousel
    , $ = layui.$
    , element = layui.element;

  // 实现搜索页面搜索框关键字的显示
  // 定义一个通过地址栏参数名称获取对应值的函数
  function GetQueryString(name) {
    let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    let r = window.location.search.substr(1).match(reg);  //获取url中"?"符后的字符串并正则匹配
    if (r != null) {
      return decodeURI(r[2]);
    } else {
      return null;
    }
  }

  // console.log(window.location.search)
  // console.log(GetQueryString('search'))
  let q = GetQueryString('q');
  if (!q) {
    location.href = '/';
  }
  $('#inputKeywords').val(q);

})
